package com.zcl.Thread.t7;

/**
 * @Description:
 * @author: zcl
 * @date: 2022/3/10  12:02
 */
public class BankTest {


}

/**
 * 单例模式懒汉式线程安全问题解决
 */
class Bank {
    private Bank() {
    }

    private static Bank instance = null;

    public static Bank getInstance() {

        if (instance == null) {
            synchronized (Bank.class) {
                if (instance == null) {
                    instance = new Bank();
                }
            }
        }
        return instance;
    }
}
